import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router'

@Component({
  selector: 'app-multiple-train',
  templateUrl: './multiple-train.component.html',
  styleUrls: ['./multiple-train.component.scss']
})
export class MultipleTrainComponent implements OnInit {
  step: number = 0;
  proportion:number = 20;
  listAddItem = [{id:1}];
  listOfSelectedValue = [];
  nodes = [
    {
      title: '保险',
      value: '保险',
      key: '0-0',
      children: [
        {
          title: '保险期限',
          value: '保险日期',
          key: '0-0-0',
          isLeaf: true
        },
        {
          title: '保险日期',
          value: '保险日期',
          key: '0-0-1',
          isLeaf: true
        }
      ]
    },
    {
      title: '个人信息',
      value: '0-1',
      key: '0-1',
      children: [
        {
          title: '投保人姓名',
          value: '投保人姓名',
          key: '0-1-0',
          isLeaf: true
        },
        {
          title: '被保人电话',
          value: '被保人电话',
          key: '0-1-1',
          isLeaf: true
        }
      ]
    }
  ];

  lineChart = {
    title: {
      text: '准确率变化'
    },
    grid:{
      top:"70px",
      left:"50px",
      right:"50px",
      bottom:"50px"
    },
    tooltip: {},
    legend: {
      data: ['销量']
    },
    xAxis: {
      name: "训练次数",
      data: ["10", "20", "30", "40", "50", "60", "70", "80", "90", "100"]
    },
    yAxis: { name: "验证集" },
    series: [{
      name: '销量',
      type: 'line',
      data: [15, 20, 36, 20, 12, 20, 15, 17, 13, 19]
    }]
  };

  constructor(private router:Router) { }

  ngOnInit() {

  }

  startTrain() {
    this.step = 1;

    setTimeout(() => {
      this.step = 2;
    }, 1500);

    setTimeout(() => {
      this.step = 3;
    }, 4000);
  }

  addKey(){
    this.listAddItem = [...this.listAddItem,{id:this.listAddItem.length+1}]
  }

  nextStep(){
    this.router.navigate(['/multiple/multipleAssessment']);
  }
}
